//
//  DocumentListTableViewCell.m
//  yonghu
//
//  Created by 浪尖渝力 on 2018/1/18.
//  Copyright © 2018年 com.DJS. All rights reserved.
//

#import "DocumentListTableViewCell.h"

@implementation DocumentListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}
-(void)creatView{
    self.backgroundColor=_LightGrey;
    UIView *beiJinView=[UIView new];
    [self addSubview:beiJinView];
    [beiJinView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.right.mas_equalTo(-5);
        make.top.mas_equalTo(7);
        make.bottom.mas_equalTo(0);
    }];
    beiJinView.backgroundColor=[UIColor whiteColor];
    beiJinView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [beiJinView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_tableDic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_tableDic objectForKey:@"document_ship_hpone"];
    UILabel *label=[UILabel new];
    [beiJinView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.right.mas_equalTo(-120);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSString *time=[_tableDic objectForKey:@"document_add_time_text"];
    UILabel *timeLabel=[UILabel new];
    [beiJinView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=time;
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSNumber *consult_status=[_tableDic objectForKey:@"document_status"];
    UILabel *statusLabel=[UILabel new];
    [beiJinView addSubview:statusLabel];
    [statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(iamgeView);
    }];
    statusLabel.textColor=ColorWithRGB(109, 179, 223);
    statusLabel.font=[UIFont systemFontOfSize:16];
    if (consult_status.intValue==0) {
        statusLabel.text=@"律师服务";
    }  if (consult_status.intValue==1) {
        statusLabel.text=@"待评价";
    }  if (consult_status.intValue==2) {
        statusLabel.text=@"已评价";
    } if (consult_status.intValue==3) {
        statusLabel.text=@"已取消";
    }
    
    NSString *consult_ct_name=[_tableDic objectForKey:@"document_dt_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [beiJinView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(timeLabel);
        make.height.mas_equalTo(30);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(15);
        make.width.mas_equalTo(size.width+14);
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.backgroundColor=[UIColor grayColor];
    ct_nameLabel.textColor=[UIColor whiteColor];
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    
    NSNumber *consult_money=[_tableDic objectForKey:@"document_money"];
    UILabel *moneyLabel=[UILabel new];
    [beiJinView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(ct_nameLabel.mas_right).mas_equalTo(20);
        make.centerY.mas_equalTo(ct_nameLabel);
    }];
    moneyLabel.text=[NSString stringWithFormat:@"¥%@/份",consult_money];
    moneyLabel.textColor=[UIColor redColor];
    moneyLabel.font=[UIFont systemFontOfSize:14];
    
    UILabel *contLable=[UILabel new];
    [self addSubview:contLable];
    [contLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView);
        make.right.mas_equalTo(statusLabel);
        make.top.mas_equalTo(ct_nameLabel.mas_bottom).mas_equalTo(20);
    }];
    contLable.numberOfLines=2;
    contLable.textColor=ColorWithRGB(79, 79, 79);
    contLable.text=[_tableDic objectForKey:@"document_content"];
    contLable.font=[UIFont systemFontOfSize:17];
}

@end
